﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ECRMS.Biz.Dom;
using ECRMS.Biz;
using ECRMS.Common;
using System.ServiceModel;
using System.ServiceModel.Web;

namespace ECRMS.Service
{
     [ServiceContract]
    public partial interface ICtIndexService
    {
        [OperationContract]
        [WebInvoke(Method = "POST", BodyStyle = WebMessageBodyStyle.Wrapped)]
         CtServiceResult<List<CtIndexGroup>> CtGetIndexGroups(Guid corpId, int userTypeId);

        [OperationContract]
        CtServiceResult<List<CtIndex>> CtGetIndexsByGroupId(Guid groupId);

        [OperationContract]
        CtServiceResult<List<CtIndex>> CtUpdateIndexs(List<CtIndex> indexs);

        [OperationContract]
        CtServiceResult CtUpdateIndexProcess(List<CtIndexProcess> indexs);

        [OperationContract]
        [WebInvoke(Method = "POST", BodyStyle = WebMessageBodyStyle.Wrapped)]
        CtServiceResult<List<CtIndexProcess>> CtGetIndexsByGroupIdAndEmployeeId(Guid groupId, Guid employeeId,int userTypeId);

        [OperationContract]
        CtServiceResult<List<CtIndexResult>> CtGetIndexResultsByGroupId(Guid groupId);

        [OperationContract]
        [WebInvoke(Method = "POST", BodyStyle = WebMessageBodyStyle.Wrapped)]
        CtServiceResult<decimal> CtEvaluateIndexGroup(List<CtIndexProcess> processes, Guid corpIndexGroupRefId);
    }

     public partial class ECRService : ICtIndexService
     {
         CtServiceResult<List<CtIndexGroup>> ICtIndexService.CtGetIndexGroups(Guid corpId,int userTypeId)
         {
             var logic = new CtIndexGroupLogic();
             return logic.GetAllIndexGroupByCorpId(corpId,userTypeId);
         }

         CtServiceResult<List<CtIndex>> ICtIndexService.CtGetIndexsByGroupId(Guid groupId)
         {
             var logic = new CtIndexLogic();
             return logic.GetIndexByGroupId(groupId);
         }

         CtServiceResult<List<CtIndex>> ICtIndexService.CtUpdateIndexs(List<CtIndex> indexs)
         {
             var logic = new CtIndexLogic();
             return logic.UpdateIndexs(indexs);
         }

         CtServiceResult ICtIndexService.CtUpdateIndexProcess(List<CtIndexProcess> indexs)
         {
             var logic = new CtIndexLogic();
             return logic.UpdateIndexProcess(indexs);
         }
         CtServiceResult<List<CtIndexProcess>> ICtIndexService.CtGetIndexsByGroupIdAndEmployeeId(Guid groupId, Guid employeeId,int userTypeId)
         {
             var logic = new CtIndexLogic();
             return logic.GetIndexByCorpIdAndEmployeeId(groupId,employeeId,userTypeId);
         }

         CtServiceResult<List<CtIndexResult>> ICtIndexService.CtGetIndexResultsByGroupId(Guid groupId)
         {
             var logic = new CtIndexResultLogic();
             return logic.GetIndexResultsByGroupId(groupId);
         }

         CtServiceResult<decimal> ICtIndexService.CtEvaluateIndexGroup(List<CtIndexProcess> processes, Guid corpIndexGroupRefId)
         {
             var logic = new CtIndexLogic();
             return logic.EvaluateIndexGroup(processes,corpIndexGroupRefId) ;
         }
     }

}
